package edu.gdpu.concurrent;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author mazebin
 * @date 2021年 07月17日 20:06:21
 * HashMap key重复，会覆盖
 *         value重复，不会覆盖
 *         -XX:+TraceClassLoading
 *         -XX:+UnlockDiagnosticVMOptions
 *         -XX:+PrintInlining
 *         */
public class HashMapTest {
    public static void main(String[] args) {
        Map<String,String> map =new HashMap();
        Map<String,String> map2 =new HashMap();
        map.put("123","456");
        map.put("123","789");
        Set<Map.Entry<String, String>> entrySet = map.entrySet();
        for (Map.Entry<String, String> entry : entrySet) {
            System.out.println("key:"+entry.getKey() +" value:"+entry.getValue());
        }
        map2.put("123","456");
        map2.put("789","456");
        map2.put("1","456");
        map2.put("2","456");
        map2.put("3","456");
        map2.put("4","456");
        map2.put("5","456");
        map2.put("6","456");
        map2.put("7","456");
        System.out.println("map2 ----");
        for (Map.Entry<String, String> entry : map2.entrySet()) {
            System.out.println("key:"+entry.getKey() +" value:"+entry.getValue());

        }

    }
}
